﻿
@page "/Bas/SettlementAccount/Details"
@using nERP.ViewModel.Bas.SettlementAccountVMs
@using System.ComponentModel.DataAnnotations
@inherits BasePage

<div>
  <ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit" >
    <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">
      <Display @bind-Value="@Model.Entity.Code"  ShowLabel="true" IsDisabled="true"/>
      <Display @bind-Value="@Model.Entity.Name"  ShowLabel="true" IsDisabled="true"/>
      <Display @bind-Value="@Model.Entity.BeginAmount"  ShowLabel="true" IsDisabled="true"/>
      <Display @bind-Value="@Model.Entity.NowAmount"  ShowLabel="true" IsDisabled="true"/>
      <Display @bind-Value="@Model.Entity.Remark"  ShowLabel="true" IsDisabled="true"/>
      <Display @bind-Value="@Model.Entity.CreateTime" ShowLabel="true" IsDisabled="true" FormatString="yyyy-MM-dd HH:mm:ss" />
      <Display @bind-Value="@Model.Entity.UpdateTime" ShowLabel="true" IsDisabled="true" FormatString="yyyy-MM-dd HH:mm:ss" />
      <Display @bind-Value="@Model.Entity.CreateBy"  ShowLabel="true" IsDisabled="true"/>
      <Display @bind-Value="@Model.Entity.UpdateBy"  ShowLabel="true" IsDisabled="true"/>
      <Display @bind-Value="@Model.Entity.IsValid"  ShowLabel="true" IsDisabled="true"/>
    </Row>

    <div class="modal-footer table-modal-footer">
      <Button OnClick="OnClose" Text="@WtmBlazor.Localizer["Sys.Close"]"/>
    </div>

  </ValidateForm>

</div>



@code {
    [Parameter]
    public string id { get; set; }
    [Parameter]
    public string[] ids { get; set; }
    private SettlementAccountVM Model = new SettlementAccountVM();
    private ValidateForm vform { get; set; }
    private async Task Submit(EditContext context)
    {
                        
        
        await PostsForm(vform, "/api/Bas/SettlementAccount/Edit", (s) => "Sys.OprationSuccess");
    }
    public void OnClose()
    {
        CloseDialog();
    }
    
    protected override async Task OnInitializedAsync()
    {
        
        
        if (id != "")
        {
            var rv = await WtmBlazor.Api.CallAPI<SettlementAccountVM>($"/api/Bas/SettlementAccount/{id}");
            Model = rv.Data;
        }

        await base.OnInitializedAsync();
    }
}
